package com.wl.mapper;

import com.wl.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LoginMapper {

    /**
     * 后台账号密码登陆接口
     * @param user 实体类
     * @return 返回用户id和jwt令牌
     */
    @Select("select * from users where username = #{username} and password = #{password}")
    User getUserInfo(User user);

    /**
     * 根据ID获取用户信息
     */
    @Select("select * from users where user_id = #{userId}")
    User getUserInfoById(Integer userId);

    /**
     * 注册
     */
    @Insert("insert into users (username, password, create_time) values (#{username}, #{password}, #{createTime})")
    void addUserInfo(User user);
}
